#include "KmyIDebug.h"
#include "KmyAlgorithm.h"

KmyIDebug::KmyIDebug()
{
}

KmyIDebug* KmyIDebug::instance = NULL;

void KmyIDebug::initialize(KmyIDebug *debuger){
    instance = debuger;
}

KmyIDebug* KmyIDebug::getInstance(){
    return instance;
}

KmyIDebug& KmyIDebug::operator <<(char t){
    char p[2];
    p[0] = t;
    p[1] = 0;
    print(p);
    return *this;
}

KmyIDebug& KmyIDebug::operator <<(bool t){
    if (t){
        string str("true");
        print(str.c_str());
    }else{
        string str("false");
        print(str.c_str());
    }
    return *this;
}

KmyIDebug& KmyIDebug::operator <<(int t){
    print(intToString(t).c_str());
    return *this;
}

KmyIDebug& KmyIDebug::operator <<(const string t){
    print(t.c_str());
    return *this;
}

KmyIDebug& KmyIDebug::operator <<(const char *t){
    print(t);
    return *this;
}

KmyIDebug& KmyIDebug::operator <<(float t){
    print(floatToString(t).c_str());
    return *this;
}

char KmyIDebug::endl(){
    return '\n';
}
